<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动影响</title>
    <style>
        * {
            margin: 0;
            height: 0;
        }
        .one {
            width: 1200px;
            /* 当没有父级高度 由子集撑开内容 就会出现塌陷 */
            /* height: 300px; */
            background-color: red;
            margin: 0 auto;
            /* 第四种 */
            /* overflow: hidden; */
        }
        .two {
            width: 1300px;
            height: 200px;
            background-color: black;
        }
        .left {
            float: left;
            width: 300px;
            height: 300px;
            background-color: skyblue;
        }
        .right {
            float: right;
            width: 850px;
            height: 300px;
            background-color: bisque;
        }
        /* 第一种在父级标签后加一个clearfix标签 */
        /* .clearfix {clear: both;} */


        /* 单伪元素法 */
        
        /* .clearfix::after {
            content: "";
            display: block;
            clear: both;
        } */

        /* 双伪元素法 */
        /* .clearfix::after,
        .clear::before {
            content: "";
            display: table;
        }

        .clearfix::after {
            clear: both;
        } */
    </style>
</head>
<body>
    <div class="one clearfix">
        <div class="left"></div>
        <div class="right"></div>
    </div>
    <!-- <div class="clearfix"></div> -->
    <div class="two"></div>
</body>
</html>